home *** CD-ROM | disk | FTP | other *** search
/ United Public Domain Gold 2 / United Public Domain Gold 2.iso / utilities / pu745.dms / pu745.adf / GLOBE099.LHA / Ami-Globe / iff / jiff.h < prev   
C/C++ Source or Header  |  1994-09-02  |  4KB  |  135 lines

  1.  
  2. /************ I usually put these in a file called format.h ****/
  3.  
  4. #define LO_RES
  5.  
  6. #ifdef HI_RES
  7. #define XMAX 640
  8. #define YMAX 200
  9. #define PLANES 4
  10. #define MAXCOL (1<<PLANES)
  11. #define XASPECT 5
  12. #define YASPECT 11
  13. #endif
  14.  
  15. #ifdef LO_RES
  16. #define XMAX 320
  17. #define YMAX 200
  18. #define PLANES 5
  19. #define MAXCOL (1<<PLANES)
  20. #define XASPECT 10
  21. #define YASPECT 11
  22. #endif
  23.  
  24. /* EA handy make a long from 4 chars macros redone to work with Aztec*/
  25. #ifndef MAKE_ID
  26. #define MAKE_ID(a, b, c, d)\
  27.     ( ((long)(a)<<24) + ((long)(b)<<16) + ((long)(c)<<8) + (long)(d) )
  28. #endif
  29.  
  30. /* these are the IFF types I deal with */
  31. #define FORM MAKE_ID('F', 'O', 'R', 'M')
  32. #define ILBM MAKE_ID('I', 'L', 'B', 'M')
  33. #define BMHD MAKE_ID('B', 'M', 'H', 'D')
  34. #define CMAP MAKE_ID('C', 'M', 'A', 'P')
  35. #define BODY MAKE_ID('B', 'O', 'D', 'Y')
  36.  
  37. /* and these are the IFF types I ignore but don't squawk about */
  38. #define GRAB MAKE_ID('G', 'R', 'A', 'B')
  39. /*#define DEST MAKE_ID('D', 'E', 'S', 'T')*/
  40. #define SPRT MAKE_ID('S', 'P', 'R', 'T')
  41. #define CAMG MAKE_ID('C', 'A', 'M', 'G')
  42. #define CRNG MAKE_ID('C', 'R', 'N', 'G')
  43. #define CCRT MAKE_ID('C', 'C', 'R', 'T')
  44. #define DPPV MAKE_ID('D', 'P', 'P', 'V')
  45.  
  46. #define ANIM MAKE_ID('A', 'N', 'I', 'M')
  47. #define ANHD MAKE_ID('A', 'N', 'H', 'D')
  48. #define DLTA MAKE_ID('D', 'L', 'T', 'A')
  49.  
  50. /* Some macros for raster memory allocation ... redefine if you're
  51.    sensible and manage memory locally */
  52.  
  53. /* ralloc - raster alloc*/
  54. #define ralloc(amount)  (PLANEPTR)AllocMem((long)(amount), MEMF_CHIP)
  55. /* rfree - raster free*/
  56. #define rfree(pt, amount)   FreeMem( (pt), (long)(amount) )
  57.  
  58. /*line_bytes = the number of words * 2 (for bytes) a raster line takes up */
  59. #define line_bytes(width)   (((width+15)>>4)<<1)
  60.  
  61. /* psize - plane size in bytes (an even number) of a raster given
  62.    width and height */
  63. #define psize(width, height) ( line_bytes(width)*height)
  64.  
  65. /* the place to throw excess bits */
  66. #define bit_bucket(hdlr, length) my_Seek(hdlr, (long)(length), OFFSET_CURRENT)
  67.  
  68.  
  69. union bytes4
  70.     {
  71.     char b4_name[4];
  72.     long b4_type;
  73.     };
  74.  
  75. struct iff_chunk
  76.     {
  77.     union bytes4 iff_type;
  78.     long iff_length;
  79.     };
  80.  
  81. struct form_chunk
  82.     {
  83.     union bytes4 fc_type; /* == FORM */
  84.     long fc_length;
  85.     union bytes4 fc_subtype;
  86.     };
  87.  
  88. struct old_BitMapHeader
  89.     {
  90.     UWORD w, h;
  91.     UWORD x, y;
  92.     UBYTE nPlanes;
  93.     UBYTE masking;
  94.     UBYTE compression;
  95.     UBYTE pad1;
  96.     UWORD transparentColor;
  97.     UBYTE xAspect, yAspect;
  98.     WORD pageWidth, pageHeight;
  99.     };
  100.  
  101. /*ILBM_info is the structure read_iff returns, and is hopefully all
  102.   you need to deal with out of the iff reader routines below*/
  103. struct ILBM_info
  104.     {
  105.     struct old_BitMapHeader header;
  106.     UBYTE   *cmap;  /*say hey aztec don't like odd length structures*/
  107.     struct BitMap bitmap;
  108.     int Nb_Col;
  109.     unsigned long   int camg;
  110.     };
  111.  
  112.  
  113. /* I sure wish C function "prototypes" were real and not just ANSI */
  114. extern int  write_iff(char *name, unsigned char *colors, struct BitMap *bits,
  115.     short xoff, short yoff, short width, short compressed); 
  116.  
  117. /* Anyone know where some useful minterms are defined? */
  118. #define COPY_MINTERM        0xc0
  119.  
  120. /***
  121.  
  122.         A meditation for the guru from the Diamond Sutra -
  123.  
  124.         So shall you think of all this fleeting world:
  125.         A star at dawn, a bubble in a stream;
  126.         A flash of lightning in a summer cloud,
  127.         A flickering lamp, a phantom, and a dream.
  128.  
  129. ***/
  130.  
  131.  
  132. extern struct ILBM_info *read_iff( char *name,short just_colors);
  133.  
  134. extern  void free_planes(register struct BitMap *bmap);
  135.